There are numerous measuring while drilling tools. The present invention is believed to be an improvement over them in that it provides a significantly self-contained device which forms the output signals modulated into the mud flow. Every well that is drilled must have a mud flow system whereby mud is pumped down the drill string and returns in the annulus on the outside of the drill string. The present invention modulates this mud flow. The apparatus is self-contained in that it generates its own electric power for operation of transducers, and the signals are imposed on a two-position, four-way valve. This valve is switched open and shut, switching between the two positions and thereby forms an output signal.